// Button variants
//
// Easily pump out default styles, as well as :hover, :focus, :active,
// and disabled options for all buttons

@mixin button-variant($background, $border, $hover-background: lighten($background, 10%), $hover-border: lighten($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 10%)) {
  border-color: $border;
  @include text {
    color: color-yiq($background);
  }
  @include gradient-bg($background);
  @include box-shadow($btn-box-shadow);

  &:hover, &:hover:focus {
    border-color: $hover-border;

    @include gradient-bg($hover-background);
    @include text {
      color: color-yiq($hover-background);
    }
  }

  &:active, &.active {
    &, &:focus {
      background-color: $active-background;
      border-color: $active-border;

      @include text {
        color: color-yiq($active-background);
      }
    }
  }

  &:focus,
  &.focus {
    background-color: $background;
    box-shadow: 0 0 0 $input-btn-focus-width rgba($border, .2);

    @include text {
      color: color-yiq($background);
    }
  }

  // Disabled comes first so active can properly restyle
  &.disabled,
  &:disabled {
    background-color: $background;
    border-color: $border;
  }
}

@mixin button-outline-variant($color, $color-hover: #fff) {
  background-color: transparent;
  background-image: none;
  border-color: $color;

  @include text {
    color: $color;
  }

  &:hover, &:focus:hover {
    background-color: $color;
    border-color: $color;

    @include text {
      color: $color-hover;
    }
  }

  &:active,
  &.active {
    &, &:focus {
      background-color: darken($color, 5);
      border-color: darken($color, 4);

      @include text {
        color: $color-hover;
      }
    }
  }

  &:focus,
  &.focus {
    border-color: $color;
    background-color: transparent;
    box-shadow: 0 0 0 $input-btn-focus-width rgba($color, .5);

    @include text {
      color: $color;
    }
  }

  &.disabled,
  &:disabled {
    background-color: transparent;

    @include text {
      color: $color;
    }
  }
}

// Button sizes
@mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) {
  padding: $padding-y $padding-x;
  @include border-radius($border-radius);
  @include text {
    font-size: $font-size;
    line-height: $line-height;
  }
}
